﻿#pragma execution_character_set("utf-8")
#include "managercenter.h"

#include <QCoreApplication>
#include <QSettings>
#include <QDebug>
#include <QSqlError>
#include <QSqlQuery>

ManagerCenter::ManagerCenter(QObject *parent) : QObject(parent)
{
    openWorkThread();
    startWorkThread();
}

ManagerCenter::~ManagerCenter()
{
    stopWorkThread();
    closeWorkThread();
}

bool ManagerCenter::getIsRun() const
{
    return isRun;
}

QList<ClearPath> ManagerCenter::getClearPathList()
{
    return clearPathDB.getClearPathList();
}

void ManagerCenter::openWorkThread()
{
     workThread = new WorkThread(this);
}

void ManagerCenter::closeWorkThread()
{
    delete workThread;
}

void ManagerCenter::startWorkThread()
{
    isRun = true;
    workThread->start();
}

void ManagerCenter::stopWorkThread()
{
    isRun = false;
    workThread->quit();
    workThread->wait();
}
